package com.app.mytestapp;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;

public class SpLashActivity extends Activity {

	PackageManager pm;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
		pm = getPackageManager();
		try {
			PackageInfo pi = pm.getPackageInfo("com.app.mytestapp", 0);
			TextView tv = (TextView)findViewById(R.id.version);
			tv.setText("version" + pi.versionCode);
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		
		new Handler().postDelayed(new Runnable() {
			
			@Override
			public void run() {
				Intent intent = new Intent();
				intent.setClass(SpLashActivity.this, MainActivity.class);
				startActivity(intent);
			}
		}, 5000);
	}
	
	
}
